package com.jk.controller;

import com.jk.api.ScenicApi;
import com.jk.bo.ReserveBO;
import com.jk.dao.ScenicDao;
import com.jk.po.DestinationPO;
import com.jk.po.OrderPO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Controller;

import java.util.Date;

@Controller
public class ScenicController implements ScenicApi {
    @Autowired
    private ScenicDao scenicDao;
    @Autowired
    private MongoTemplate mongoTemplate;
/*
 * @param id
 * @author 赵磊荣
 * @date 2021/7/1 9:39
 * @return 景点详情
 */
    @Override
    public DestinationPO queryScenicbyId(String id) {
        return scenicDao.selectById(id);
    }
/*
 * @param rbO
 * @author 赵磊荣
 * @date 2021/7/1 10:01
 * @return 新增景点
 */
    @Override
    public void saveScenicinfo(ReserveBO rbO) {
        OrderPO order = new OrderPO();
        order.setAreaname(rbO.getAreaname());
        order.setHotelname(rbO.getHotelname());
        order.setHotelprice(rbO.getHotelprice());
        order.setTraveltime(rbO.getTraveltime());
        order.setPhone(rbO.getPhone());
        order.setContacts(rbO.getContacts());
        order.setRealname(rbO.getRealname());
        order.setTotalprice(rbO.getTotalprice());
        order.setCreationtime(new Date());
        order.setChildrenticket(rbO.getChildrenticket());
        order.setAdultticket(rbO.getAdultticket());
        order.setOrderstatus(rbO.getOrderstatus());

        mongoTemplate.save(order);

    }
}
